<div class="t">
  <table id="items_tb" class='items'>
    <tr>
      <th>型号</th>
      <th>名称</th>
      <th>规格</th>
      <th>颜色</th>
      <th>数量</th>
      <th>备注</th>
      <th>售后成本</th>
      <th colspan='2'>最新进展</th>
    </tr>
    <% 
    order.order_items.each do |order_item| %>
    <tr id="tr_<%= order_item.id %>" class="<%= cycle 'h','' %>">
      <td><%= order_item.furniture_code %></td>
      <td><%= order_item.furniture_name %></td>
      <td><%= order_item.furniture_spec %></td>
      <td><%= order_item.furniture_color %></td>
      <td><%= order_item.ordered_count %></td>
      <td title='<%= order_item.remark %>'><%= truncate order_item.remark, :length => 10 %></td>
      <td id="td_<%= order_item.id %>">￥<%= number_with_precision(order_item.after_serviced_cost, :precision => 2)%></td>
      <td>
        <%= t order_item.feed.code %>      
        <%= link_to_function '展开或隐藏','',:id => "feeds_on_off_#{order_item.id}", :class => 'off', :title => '进展情况' %>
      </td>
      <td class='r'>
        <div id='order_item_tool_<%= order_item.id %>' class='tools'>
          <div>
            <%if can_edit && order.can_be_edited_by_current_user? #是show页面，并且是当前用户编辑%>
            <%= link_to '编辑', 
                  edit_order_item_order_url(order_item), 
                  :remote => true, 
                  :method => :get, 
                  :title => '编辑该预订项',
                  :class => 'l_crud l_edit' %>
            <%= link_to "删除",
                  order_url(order_item),
                  :confirm => "确认要删除【#{order_item.furniture_code}-#{order_item.furniture_name}】吗？",
                  :method => :delete,
                  :title => '删除该预订项',
                  :remote=> true,
                  :class => 'l_crud l_delete',
                  :id => "del#{order_item.id}"
             %>
            <%end%>
          </div>
        </div>
      </td>
    </tr>
    <tr id='item_feeds_<%= order_item.id %>' class='feeds'>
      <td colspan='9'>
        <!--这里是进展情况-->
        <%= render :partial => 'orders/feeds/index.html', :locals => {:order_item => order_item, :can_edit => can_edit} %>
      </td>
    </tr>
    <script type="text/javascript" charset="utf-8">
      <%if can_edit && order.can_be_edited_by_current_user? #是show页面，并且是当前用户编辑%>
      $('#tr_<%= order_item.id %>').mouseover(function() {
        $('#order_item_tool_<%= order_item.id %>').show();
      });
      $('#tr_<%= order_item.id %>').mouseout(function() {
        $('#order_item_tool_<%= order_item.id %>').hide();
      });
      <%end%>
      $('#feeds_on_off_<%= order_item.id %>').click(function() {
        $('#feeds_on_off_<%= order_item.id %>').toggleClass('on');
        $('#item_feeds_<%= order_item.id %>').toggle('fast');
      });
    </script>
    <% end %>
  </table>
</div>
